package com.zhaotianhao.springboot_demo_fire.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhaotianhao.springboot_demo_fire.entity.Firearms;
import com.zhaotianhao.springboot_demo_fire.entity.Parts;
import com.zhaotianhao.springboot_demo_fire.mapper.FirearmsMapper;
import com.zhaotianhao.springboot_demo_fire.service.IFirearmsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Z-7
 * @since 2022-03-22
 */
@Slf4j
@Service
public class FirearmsServiceImpl extends ServiceImpl<FirearmsMapper, Firearms> implements IFirearmsService {

    /**
     * 列表
     *
     * @param pageNum
     * @param pageSize
     * @return
     */
    @Override
    public PageInfo<Firearms> getPageInfo(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Firearms> list = getBaseMapper().queryAll();
        return new PageInfo<>(list);
    }
    /**
     * 根据id查询
     *
     * @param id
     * @return
     */
    @Override
    public Firearms queryById(Integer id) {
        return getBaseMapper().queryById(id);
    }
}
